package com.TripMate.system.service;

import com.TripMate.system.model.dto.chat.AiHistoryByMyQueryRequest;
import com.TripMate.system.model.dto.chat.AiHistoryQueryRequest;
import com.TripMate.system.model.dto.chat.ChatRequest;
import com.TripMate.system.model.entity.AiHistory;
import com.TripMate.system.model.vo.AiHistoryByMyVO;
import com.TripMate.system.model.vo.AiHistoryVO;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import reactor.core.publisher.Flux;

/**
 * @author dongmianyan
 * @description 针对表【ai_history(AI回答历史记录表)】的数据库操作Service
 * @createDate 2024-11-29 10:24:44
 */
public interface AiHistoryService extends IService<AiHistory> {
    /**
     * Handles the chat request based on the provided ChatRequest payload.
     *
     * @param chatRequest The chat request containing content and protocol type.
     * @return A response string or JSON representing the result.
     */
    Flux<String> handleChat(ChatRequest chatRequest);

    /**
     * Generates a new session ID.
     *
     * @return A unique session ID.
     */
    String generateSessionId();

    /**
     * Generates a new request ID.
     *
     * @return A unique request ID.
     */
    String generateRequestId();

    /**
     * 查询全部的 AI 历史聊天记录。
     *
     * @param aidHistoryQueryRequest The query parameters for filtering and pagination.
     * @return A page of AI history records.
     */
    Page<AiHistoryVO> getQueryByAll(Page<AiHistoryVO> pageParam, AiHistoryQueryRequest aidHistoryQueryRequest);

    Page<AiHistoryVO> getQueryByMy(Page<AiHistoryVO> pageParam, AiHistoryByMyQueryRequest aidHistoryQueryRequest, Long userId);
}
